/*
 * RSIntArray.h
 *
 *  Created on: 2010/03/17
 *      Author: alexandre
 */

#ifndef RSINTARRAY_H_
#define RSINTARRAY_H_

#include "RSArrayElement.h"
#include <QVector>

namespace Realsphere {

    class RSIntArray : public Realsphere::RSArrayElement {
        Q_OBJECT
        public:
            RSIntArray ();
            RSIntArray ( const QString& rId );
            RSIntArray ( const QString& rId, const QString& rName );
            RSIntArray ( const int rArray[] );
            RSIntArray ( const int rArray[], const QString& rId );
            RSIntArray ( const int rArray[], const QString& rId, const QString& rName );
            RSIntArray ( const int* rArray, unsigned int rSize );
            RSIntArray ( const int* rArray, unsigned int rSize , const QString& rId );
            RSIntArray ( const int* rArray, unsigned int rSize , const QString& rId, const QString& rName );

            ~RSIntArray ();
        public:

            RSArrayElementType              ArrayType () const;
            int                             Count () const;
            RSDataPointer                   DataPointer ();
            RSDataSize                      SizeOf () const;
            QString                         ToString () const;

        public slots:
            void                            Clear( bool rEmit = true );
            void                            Append ( const RSValueElement& rValue, bool rEmit = true );
            void                            Append ( const RSInt& rValue, bool rEmit = true );
            void                            Append ( const int& rValue, bool rEmit = true );
            void                            Append ( const int rValue[], bool rEmit = true );
            void                            Append ( const int* rValue, unsigned int rSize, bool rEmit = true );
            void                            Remove ( unsigned int rIndex, bool rEmit = true );
            void                            Remove ( unsigned int rIndex, unsigned int rSize, bool rEmit = true );
            void                            SetValue ( unsigned int rIndex, const RSValueElement& rValue, bool rEmit = true );
            void                            SetValue ( unsigned int rIndex, const RSInt& rValue, bool rEmit = true );
            void                            SetValue ( unsigned int rIndex, const int& rValue, bool rEmit = true );

        public:
            int&                            operator[] ( int rIndex );
            const int&                      operator[] ( int rIndex ) const;

        private:
            QVector<int>                    mData;
    };

}

#endif /* RSINTARRAY_H_ */
